package mess;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class LeeCode_191 {
    public static void main(String[] args) {
        System.out.println(hammingWeight(126729));
    }
    private static int hammingWeight(int n) {
        int count = 0;
        while(n >= 2){
            count += n % 2 == 0 ? 0 : 1;
            n = n / 2;
        }

        return n == 1 ? count + 1 : count;
    }
}
